import React from "react";
import LinearGradient from "react-native-linear-gradient";
import { Text } from "react-native";

const GradientButton = ({
  style = {},
  textStyle = {},
  colors,
  text,
  children,
}) => {
  return (
    <LinearGradient
      style={{
        padding: 4,
        borderRadius: 4,
        ...style,
      }}
      colors={colors}
      start={{ x: 0, y: -0.25 }}
      end={{ x: 1.75, y: 2 }}
    >
      {children || (
        <Text
          style={{
            color: "rgb(255, 255, 255)",
            ...textStyle,
          }}
        >
          {text}
        </Text>
      )}
    </LinearGradient>
  );
};

export default GradientButton;
